package com.study.blog.service.impl;

import com.study.blog.mapper.AdminMapper;
import com.study.blog.model.entity.Admin;
import com.study.blog.service.AdminService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;

@Service
public class AdminServiceImpl implements AdminService {


    @Autowired
    private AdminMapper adminMapper;

    @Override
    public Boolean activationAccount(String email) {
        return adminMapper.activationAccount(email) == 1;
    }

    @Override
    public Boolean checkAccountValid(String email) {
        return !ObjectUtils.isEmpty(adminMapper.checkAccountValid(email));
    }

    @Override
    public Boolean checkAccountExist(String email) {
        return !ObjectUtils.isEmpty(adminMapper.checkAccountExist(email));
    }

    @Override
    public Boolean login(String email, String password) {
        return !ObjectUtils.isEmpty(adminMapper.login(email, password));
    }

    @Override
    public Boolean register(Admin admin) {
        return adminMapper.register(admin) == 1;
    }

    @Override
    public Boolean abort(String email) {
        return adminMapper.abort(email) == 1;
    }
}
